# -*- coding:utf-8 -*-
# --author： jingfeng 
# time: 2019/2/20

from selenium import webdriver
import requests
from bs4 import BeautifulSoup
from urllib.parse import unquote

requests = requests.Session()

def get_url():
    url = 'http://www.manhuadao.cn/Comic/All?'
    browser = webdriver.Chrome()
    browser.get(url)

   # print(browser.page_source)
    soup = BeautifulSoup(browser.page_source, 'html5lib')
    list = soup.find_all('div', class_="item-right")
    for i in list:
        href = i.find('a')['href']
        href = href.split('=')[-1]
        href = unquote(href)

        title = i.find('a').get_text()
        print(title +'>>',href)

        browser.get(href)
        soup = BeautifulSoup(browser.page_source, 'html5lib')
        a = soup.find_all('a', class_="yesReader")
        for a1 in a:
            href = a1['href']
            href = href.split('=')[-1]
            href = unquote(href)

            print(href)
            browser.get(href)
            print(browser.page_source)
get_url()
